<HTML>
<HEAD>
<TITLE>[Chapter 19] AWTEvent </TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:08:52 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_01.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 19<br>java.awt Reference</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch19_03.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>AWTEvent <img src="gifs/bstar.gif" alt="(New)" border=0></H1>

<H2>Name</H2>

AWTEvent <img src="gifs/bstar.gif" alt="(New)" border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch19-REFSECT1-AUTOID.2"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/awteve2.gif" alt="[Graphic: Figure from the text]" width=502 height=203 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-1">Description</A></h2>

<P CLASS=para>
The root class of all AWT events. Subclasses of this class are the replacement 
for <tt CLASS=literal>java.awt.Event</tt>, which is 
only used for the Java 1.0.2 event model. In Java 1.1, event objects are passed from 
event source components to objects implementing a corresponding listener 
interface. Some event sources have a corresponding interface, too. For 
example, <tt CLASS=literal>AdjustmentEvent</tt>s are 
passed from <tt CLASS=literal>Adjustable</tt> objects 
to <tt CLASS=literal>AdjustmentListener</tt>s. Some 
event types do not have corresponding interfaces; for example, <tt CLASS=literal>ActionEvent</tt>s 
are passed from <tt CLASS=literal>Button</tt>s to 
<tt CLASS=literal>ActionListener</tt>s, but there 
is no "Actionable" interface that <tt CLASS=literal>Button</tt> 
implements. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-2">Class Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public abstract class java.awt.AWTEvent
    extends java.util.EventObject {
  // Constants
  public final static long ACTION_EVENT_MASK;
  public final static long ADJUSTMENT_EVENT_MASK;
  public final static long COMPONENT_EVENT_MASK;
  public final static long CONTAINER_EVENT_MASK;
  public final static long FOCUS_EVENT_MASK;
  public final static long ITEM_EVENT_MASK;
  public final static long KEY_EVENT_MASK;
  public final static long MOUSE_EVENT_MASK;
  public final static long MOUSE_MOTION_EVENT_MASK;
  public final static long RESERVED_ID_MAX;
  public final static long TEXT_EVENT_MASK;
  public final static long WINDOW_EVENT_MASK;
  // Variables
  protected boolean consumed;
  protected int id;
  // Constructors
  public AWTEvent (Event event);
  public AWTEvent (Object source, int id);
  // Instance Methods
  public int getID();
  public String paramString();
  public String toString();
  // Protected Instance Methods
  protected void consume();
  protected boolean isConsumed();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3">Constants</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.1">ACTION_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.1.1">public static final long ACTION_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for action events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.2">ADJUSTMENT_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.2.1">public static final long ADJUSTMENT_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for adjustment events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.3">COMPONENT_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.3.1">public static final long COMPONENT_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for component events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.4">CONTAINER_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.4.1">public static final long CONTAINER_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for container events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.5">FOCUS_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.5.1">public static final long FOCUS_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for focus events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.6">ITEM_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.6.1">public static final long ITEM_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for item events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.7">KEY_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.7.1">public static final long KEY_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for key events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.8">MOUSE_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.8.1">public static final long MOUSE_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for mouse events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.9">MOUSE_MOTION_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.9.1">public static final long MOUSE_MOTION_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for mouse motion events.

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.9.5">RESERVED_ID_MAX</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.9.5.1">public static final int</A></h4>

<P CLASS=para>
The maximum reserved event id. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.10">TEXT_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.10.1">public static final long TEXT_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for text events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.11">WINDOW_EVENT_MASK</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-3.11.1">public static final long WINDOW_EVENT_MASK</A></h4>

<P CLASS=para>
The mask for window events. 

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-4">Variables</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-4.1">consumed</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-4.1.1">protected boolean consumed</A></h4>

<P CLASS=para>
If <tt CLASS=literal>consumed</tt> is <tt CLASS=literal>true</tt>, 
the event will not be sent back to the peer. Semantic events will never 
be sent back to a peer; thus <tt CLASS=literal>consumed</tt> 
is always <tt CLASS=literal>true</tt> for semantic 
events. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-4.2">id</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-4.2.1">protected int id</A></h4>

<P CLASS=para>
The type ID of this event. 

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-5">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-5.1">AWTEvent</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-5.1.1">public AWTEvent (Event event)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>event</I><br>
<DD>

<P CLASS=para>
A version 1.0.2 <tt CLASS=literal>java.awt.Event</tt> object. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a 1.1 <tt CLASS=literal>java.awt.AWTEvent</tt> 
derived from a 1.0.2 <tt CLASS=literal>java.awt.Event</tt> object. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-5.1.2">public AWTEvent (Object source, int id)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>source</I><br>
<DD>

<P CLASS=para>
The object that the event originated from. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>id</I><br>
<DD>

<P CLASS=para>
An event type ID. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs an <tt CLASS=literal>AWTEvent</tt> object.</DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-6">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-6.1">getID</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-6.1.1">public int getID()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The type ID of the event. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-6.2">paramString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-6.2.1">public String paramString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A string with the current settings of <tt CLASS=literal>AWTEvent</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Helper method for <tt CLASS=literal>toString()</tt> 
that generates a string of current settings. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-6.3">toString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-6.3.1">public String toString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A string representation of the <tt CLASS=literal>AWTEvent</tt> object. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.toString()</tt> </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-7">Protected Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-7.1">consume</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-7.1.1">protected void consume()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Consumes the event so it is not sent back to its source. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-7.2">isConsumed</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-7.2.1">public boolean isConsumed()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A flag indicating whether this event has been consumed. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-AWTEVENT-SECT-8">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>ActionEvent</tt>, <tt CLASS=literal>AdjustmentEvent</tt>, 
<tt CLASS=literal>ComponentEvent</tt>, <tt CLASS=literal>Event</tt>, 
<tt CLASS=literal>EventObject</tt>, <tt CLASS=literal>FocusEvent</tt>, 
<tt CLASS=literal>ItemEvent</tt>, <tt CLASS=literal>KeyEvent</tt>, 
<tt CLASS=literal>MouseEvent</tt>, <tt CLASS=literal>WindowEvent</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_01.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch19_03.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>AWTError</td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>AWTEventMulticaster <img src="gifs/bstar.gif" alt="(New)" border=0></td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
